﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Netcached.Tests
{
    [TestClass]
    public class TestAdd : BaseTestClass
    {
        [TestMethod]
        public void TestAddValue()
        {
            string key = "TestAdd.TestAddValue";
            string value = "data";

            var result = Client.Add(key, value);
            Assert.IsTrue(result);

            var fetchedValue = Client.Get(key);
            Assert.AreEqual(value, fetchedValue);
        }

        [TestMethod]
        public void TestAddIfExists()
        {
            string key = "TestAdd.TestAddIfExists";
            string value = "data";

            Client.Add(key, value);
            var result = Client.Add(key, value);

            Assert.IsFalse(result);
        }
    }
}
